<template>
  <div class="middlecard">
    <div class="imgbox" @click="playvideo">
      <img :src="item.children[0].model.resource.cover" alt="" />
      <div class="count">
        <span
          ><i class="iconfont icon-chakan"></i>
          {{ item.children[0].model.resource.count.count_view | count }}
        </span>
        <span class="like">
          <i class="iconfont icon-31dianzan"></i>
          {{ item.children[0].model.resource.count.count_like | count }}</span
        >
        <span>{{ item.children[0].model.resource.duration | delaytime }}</span>
      </div>
    </div>
    <p class="title">{{ item.children[0].model.resource.title }}</p>
    <div class="foot">
      <span @click="onClick" class="user">{{item.children[0].model.resource.author.userinfo.username}}</span>
      <i class="iconfont icon-androidgengduo"></i>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    item: Object,
  },
  methods:{
    playvideo() {
      if(this.item.children){
        this.$router.push({ path: "/playvideoview",query:{id:this.item.children[0].model.resource.id} });
      }
    },
    onClick(){
      if(this.item.children[0].model.resource.author.userinfo.is_vmovier_migrate_user){
        this.playvideo();
      }else{
        var id = this.item.children[0].model.resource.author.userinfo.id
        this.$router.push({path:"/userpage",query:{id:id}})      
      }
      },
  }
};
</script>

<style lang="less" scoped>
.middlecard {
  width: 100%;
  height: 100%;
  background-color: #fff;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  .imgbox {
    position: relative;
    width: 100%;
    height: 50%;
    img{
      width: 100%;
      height: 100%;
    }
    .count {
      display: flex;
      justify-content: space-between;
      position: absolute;
      align-items: flex-end;
      width: 100%;
      padding: 0 5px;
      left: 0px;
      bottom: 10px;
      color: #fff;
      font-size: 12px;
      .like {
        flex: 1;
        margin-left: 5px;
      }
    }
  }
  .title {
    margin: 10px 5px;
    font-weight: 500;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .foot{
    color: #ccc;
    display: flex;
    justify-content: space-between;
    position: absolute;
    width: 100%;
    padding: 0 10px;
    bottom: 10px;
    span{
      display: inline-block;
      width: 126px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: 14px;
    }
  }
}
</style>